package cn.cumt.lkk.webapp.controller;

import cn.cumt.lkk.model.Link;
import cn.cumt.lkk.service.GenericManager;
import cn.cumt.lkk.service.LinkManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by lkk on 2015/4/30.
 */
@Controller
@RequestMapping("/links*")
public class LinkController {
    private LinkManager linkManager;

    @Autowired
    public void setLinkManager(@Qualifier("linkManager") LinkManager linkManager) {
        this.linkManager = linkManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handRequest() {
        ModelAndView result = new ModelAndView();
        result.addObject("linkList",linkManager.getAll());
        return result;
    }
}
